package icu.zqyhdm.commonService.controller;

import icu.zqyhdm.commonService.service.MessageService;
import icu.zqyhdm.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 发送手机验证码接口
 * @Author lifu
 * @Date 2021/7/9 21:33
 */
@Api(tags = "发送手机验证码接口")
@RestController
@RequestMapping(value = "/api/common-service/message")
public class MessageController {

    @Autowired
    private MessageService messageService;

    /**
     * 发送手机验证码接口，返回验证码，将验证码存进redi的过程有调用该服务的业务实现
     */
    @ApiOperation(value = "发送手机验证码")
    @GetMapping(value = "/sendCode/{phone}")
    public Result sendCode(@PathVariable String phone) {
        String code = messageService.send(phone);
        return Result.ok(code);
    }
}
